home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 23 / Amiga Format AFCD23 (Feb 1998, Issue 107).iso / -seriously_amiga- / shareware / programming / other / hunk / hoppers / manx.hop < prev    next >
Text File  |  1997-12-01  |  5KB  |  144 lines

  1. ;*************************************************************************
  2. ;** Manx Math routines                                                  **
  3. ;** Contributor: L.Lucius                               Nov  15th 1993  **
  4. ;** Modified for HOp:   Thomas Richter  (thor)          Nov  1st  1997  **
  5. ;** Function:    Modify 68000 math routines to use 68020+ instructions. **
  6. ;*************************************************************************
  7.  
  8.  
  9.  
  10. ;*************************************************************************
  11. ;
  12. ; DIVS
  13. ;
  14. #match
  15. #code
  16. 48E7 4800                       ;   MOVEM.L     D1/D4,-(A7)
  17. 4284                            ;   CLR.L       D4
  18. 4A80                            ;   TST.L       D0
  19. 6A04                            ;   BPL.B       000E
  20. 4480                            ;   NEG.L       D0
  21. 5244                            ;   ADDQ.W      #1,D4
  22. 4A81                            ;   TST.L       D1
  23. 6A06                            ;   BPL.B       0018
  24. 4481                            ;   NEG.L       D1
  25. 0A44 0001                       ;   EORI.W      #0001,D4
  26. 613E                            ;   BSR.B       0058
  27. 4A44                            ;   TST.W       D4
  28. 6702                            ;   BEQ.B       0020
  29. 4480                            ;   NEG.L       D0
  30. 4CDF 0012                       ;   MOVEM.L     (A7)+,D1/D4
  31. 4A80                            ;   TST.L       D0
  32. 4E75                            ;   RTS
  33. ;
  34. ;
  35. #replace
  36. 4C41 0800                       ;   DIVS.L      D1,D0
  37. 4E75                            ;   RTS
  38. #end
  39.  
  40.  
  41.  
  42. ;*************************************************************************
  43. ;
  44. ; DIVU/MODU
  45. ;
  46. #match
  47. #code
  48. 48E7 3000                       ;   MOVEM.L     D2-D3,-(A7)
  49. 4841                            ;   SWAP        D1
  50. 4A41                            ;   TST.W       D1
  51. 6628                            ;   BNE.B       0032
  52. 4841                            ;   SWAP        D1
  53. 4243                            ;   CLR.W       D3
  54. 80C1                            ;   DIVU.W      D1,D0
  55. 680E                            ;   BVC.B       0020
  56. 3400                            ;   MOVE.W      D0,D2
  57. 4240                            ;   CLR.W       D0
  58. 4840                            ;   SWAP        D0
  59. 80C1                            ;   DIVU.W      D1,D0
  60. 3600                            ;   MOVE.W      D0,D3
  61. 3002                            ;   MOVE.W      D2,D0
  62. 80C1                            ;   DIVU.W      D1,D0
  63. 2200                            ;   MOVE.L      D0,D1
  64. 4840                            ;   SWAP        D0
  65. 3003                            ;   MOVE.W      D3,D0
  66. 4840                            ;   SWAP        D0
  67. 4241                            ;   CLR.W       D1
  68. 4841                            ;   SWAP        D1
  69. 4CDF 000C                       ;   MOVEM.L     (A7)+,D2-D3
  70. 4E75                            ;   RTS
  71. ;
  72. ;
  73. #replace
  74. 4C41 0001                       ;   DIVUL.L     D1,D1:D0
  75. 4E75                            ;   RTS
  76. #end
  77.  
  78.  
  79. ;*************************************************************************
  80. ;
  81. ; MODS
  82. ;
  83. #match
  84. #code
  85. 48E7 4800                       ;   MOVEM.L     D1/D4,-(A7)
  86. 4284                            ;   CLR.L       D4
  87. 4A80                            ;   TST.L       D0
  88. 6A04                            ;   BPL.B       000E
  89. 4480                            ;   NEG.L       D0
  90. 5244                            ;   ADDQ.W      #1,D4
  91. 4A81                            ;   TST.L       D1
  92. 6A02                            ;   BPL.B       0014
  93. 4481                            ;   NEG.L       D1
  94. 611A                            ;   BSR.B       0030
  95. 2001                            ;   MOVE.L      D1,D0
  96. 60D8                            ;   BRA.B       FFF2
  97. 2F01                            ;   MOVE.L      D1,-(A7)
  98. 6112                            ;   BSR.B       0030
  99. 2001                            ;   MOVE.L      D1,D0
  100. 221F                            ;   MOVE.L      (A7)+,D1
  101. 4A80                            ;   TST.L       D0
  102. 4E75                            ;   RTS
  103. ;
  104. ;
  105. #replace
  106. 2F01                            ;   MOVE.L      D1,-(A7)
  107. 4C41 0801                       ;   DIVSL.L     D1,D1:D0
  108. C141                            ;   EXG         D0,D1
  109. 221F                            ;   MOVE.L      (A7)+,D1
  110. 4A80                            ;   TST.L       D0
  111. 4E75                            ;   RTS
  112. #end
  113.  
  114.  
  115. ;*************************************************************************
  116. ;
  117. ; MULU
  118. ;
  119. #match
  120. #code
  121. 48E7 7000                       ;   MOVEM.L     D1-D3,-(A7)
  122. 3401                            ;   MOVE.W      D1,D2
  123. C4C0                            ;   MULU.W      D0,D2
  124. 2601                            ;   MOVE.L      D1,D3
  125. 4843                            ;   SWAP        D3
  126. C6C0                            ;   MULU.W      D0,D3
  127. 4843                            ;   SWAP        D3
  128. 4243                            ;   CLR.W       D3
  129. D483                            ;   ADD.L       D3,D2
  130. 4840                            ;   SWAP        D0
  131. C0C1                            ;   MULU.W      D1,D0
  132. 4840                            ;   SWAP        D0
  133. 4240                            ;   CLR.W       D0
  134. D082                            ;   ADD.L       D2,D0
  135. 4CDF 000E                       ;   MOVEM.L     (A7)+,D1-D3
  136. 4E75                            ;   RTS
  137. ;
  138. ;
  139. #replace
  140. 4C01 0000                       ;   MULU.L      D1,D0
  141. 4E75                            ;   RTS
  142. #end
  143.  
  144.